/*		登陆表单		*/
function showLoginForm(){
    top.layer.open({
        title:'欢迎回来',
        btn: false,
        type: 2,
        offset:'100px',
        resize:false,
        skin:'layui-layer-admin',
        area: ['360px','335px'],
        content: '/loginForm/login'
    });
}
function showRegForm(){
    top.layer.open({
        title:'账号注册',
        btn: false,
        type: 2,
        offset:'100px',
        resize:false,
        area: ['360px','450px'],
        content: '/loginForm/register'
    });
}
function pop_login(){
    var username = $('#pop-username').val();
    var password = $('#pop-password').val();
    if(B.isEmpty(username)){
        B.error("账号不能为空");
        //$('#pop-username').focus();
        //return;
    }
    if(B.isEmpty(password)){
        B.error("密码不能为空");
        $('#pop-password').focus();
        return;
    }
    B.post({
        url:'/login',
        data:{username:username,password:password},
        loading:true,
        success:function(res){
            if(res.success){
                layer.msg('登录成功', {icon: 1, time: 1000}, function () {
                    top.window.location.reload();
                });
            }else{
                B.error(res.msg);
            }
        }
    });
}
/**
 * 封装一个居中打开新窗口的方法
 */
function openLoginWindow(url, width, height)
{
    width = width || 600;
    height = height || 400;
    var left = (window.screen.width - width) / 2;
    var top = (window.screen.height - height) / 2;
    window.open(url, "_blank", "toolbar=yes, location=yes, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=no, copyhistory=yes, left="+left+", top="+top+", width="+width+", height="+height);
}
